package com.baogang.component;


import com.baogang.service.SwingCardRecordService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
@Slf4j
public class ScheduledService {
    @Resource
    private SwingCardRecordService swingCardRecordService;

    @Scheduled(cron = "0 0 2 * * ?")
    public void scheduled() {
        // 每天凌晨删一点同步数据
        swingCardRecordService.doPost();
        
    }


//    @Scheduled(cron = "0 */1 * * * ?")
//    public void oneMiniutes() {
//        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        log.info("now is: {}", format.format(new Date()));
//    }
}
